import request from '@/utils/request';

// 打印工单
export async function getWorkOrderInfoBarCode(data: any) {
  return request('/api/material/getWorkOrderInfoBarCode', {
    method: 'GET',
    responseType: 'blob',
    params: {
      id: data.id,
    },
  });
}

// 批量打印工单为PDF文件
export async function getPdfs(data: any){
  return request('/api/pack/getPdfs',{
    method: 'GET',
    responseType: 'blob',
    params:{
      ids: data,
    }
  })
}

export async function getWorkOrderInforByPage(params: any) {
  return request('/api/product/getWorkOrderInforByPage', {
    method: 'POST',
    data: params,
  });
}

export async function getWorkOrderInforExtendByPage(params: any) {
  return request('/api/product/getWorkOrderInforExtendByPage', {
    method: 'POST',
    data: params,
  });
}

export async function addWorkOrderInfor(params: any) {
  return request('/api/product/addWorkOrderInfor', {
    method: 'POST',
    data: params,
  });
}

export async function updateWorkOrderInfor(params: any) {
  return request('/api/product/updateWorkOrderInfor', {
    method: 'POST',
    data: params,
  });
}

export async function delWorkOrderInfor(params: any) {
  return request('/api/product/delWorkOrderInfor', {
    method: 'POST',
    data: params,
  });
}

export default {
  getWorkOrderInforByPage,
  getWorkOrderInforExtendByPage,
  addWorkOrderInfor,
  updateWorkOrderInfor,
  delWorkOrderInfor,
};
